﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>发起流程</title>
    <!-- jQuery -->
    <!--<script src="vendor/angular/angular.js"></script>-->
    <!--<script src="js/main.js"></script>-->
    <script src="vendor/jquery/jquery.min.js"></script>
    <script src="WFRes/_Scripts/jquery/jquery.lang.js"></script>
    <script src="WFRes/_Scripts/H3AdminPlugins.js"></script>
    <script>
        var params = [];
        getUrlVars = function () {
            var vars = {};
            var hash;
            var hashs = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
            for (var i = 0; i < hashs.length; i++) {
                hash = hashs[i].split('=');
                vars[hash[0]] = hash[1];
            }
            return vars;
        }

        window.onload = function () {
            //获取URL参数
            //console.log(new Date().getTime());
            params = getUrlVars();
            var paramString = JSON.stringify(params);
        //    debugger
            $.ajax({
                url: "Organization/GetCurrentUser?" + new Date().getTime(),
                type: "GET",
                dataType: "JSON",
                async: false,
                params: {
                    random: new Date().getTime()
                },
                success: function (result, header, config, status) {
                    // console.log(result.Success, 'result')
                    if (!result.Success) {
                        window.top.location.href = "/Portal/#/platform/login";
                    } else {
                        $.ajax({
                            type: "POST",
                            async: false,
                            url: "StartInstance/StartInstance",
                            data: {paramString: paramString},
                            dataType: "json",
                            success: function (data) {
                                if (data.Success) {
                                    // console.log(data.DivContent, 'data')
                                    // debugger
                                    window.localStorage.setItem("divContent", data.DivContent);
                                    window.localStorage.setItem("postURL", data.PostURL);
                                    window.location.href = data.Message;
                                } else {
                                    var message;
                                    if ($.Lang(data.Message) == data.Message) {
                                        message = data.Messag
                                    } else {
                                        message = $.Lang(data.Message);
                                    }
                                    $.H3Dialog.Warn({content: message});
                                }
                            }
                        });
                    }
                },
                error: function (a, b, c) {
                    //$state.go("platform.login");
                    // alert("error");
                    window.top.location.href = "/Portal/#/platform/login"
                }
            });
        }
    </script>
</head>
<body>

</body>
</html>
